/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.informet.ipd.struts.action;

import com.informet.ipd.modelo.dao.MarcoLogicoDao;
import com.informet.ipd.modelo.dao.OEstrategicoDao;
import com.informet.ipd.modelo.dao.ProgEstrDao;
import com.informet.ipd.struts.form.PEIForm;
import com.informet.ipd.struts.form.ProgEstrForm;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.JOptionPane;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

/**
 *
 * @author ricco
 */
public class ReportesAction extends DispatchAction {

    /* forward name="success" path="" */
    private static final String SUCCESS = "success";

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        return mapping.findForward(SUCCESS);
    }
//
//    public ActionForward programasEstrategicos(ActionMapping mapping, ActionForm form,
//            HttpServletRequest request, HttpServletResponse response)
//            throws Exception {
//
//        PEIForm form1 = (PEIForm) form;
//        List listaObjetivo = new OEstrategicoDao().getlist();
//        form1.setListaOEstrategico(listaObjetivo);
//        JOptionPane.showMessageDialog(null, listaObjetivo);
//
//
//        return mapping.findForward("actividadObjetivo");
//    }

    public ActionForward proyectos(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        ProgEstrForm form1 = (ProgEstrForm) form;
        List listaFinMarcoLogico = new MarcoLogicoDao().getlistMarcoLogicoFin();
        List listaPropMarcoLogico = new MarcoLogicoDao().getlistMarcoLogicoProposito();
        List listaCompMarcoLogico = new MarcoLogicoDao().getlistMarcoLogicoComponente();
        List listaDetailMarLogFin = new MarcoLogicoDao().getlistMarcoLogicoProgramaI();

        //List listaDetailMarLogFin =new ProgEstrMarLogDao().getlistFinInv(codPrograma);
        //form1.setListDetalleMarcoLogicoProposito(listaPropMarcoLogico);
        //form1.setListDetalleMarcoLogicoFin(listaFinMarcoLogico);
        //form1.setListDetalleMarcoLogicoComponente(listaCompMarcoLogico);


        form1.setListPrograma(listaDetailMarLogFin);
        form1.setListDetalleMarcoLogicoProposito(listaPropMarcoLogico);
        form1.setListDetalleMarcoLogicoFin(listaFinMarcoLogico);
        form1.setListDetalleMarcoLogicoComponente(listaCompMarcoLogico);


        return mapping.findForward("proyectos");
    }

    public ActionForward poi(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        ProgEstrForm form1 = (ProgEstrForm) form;
        List listOGE = new ProgEstrDao().getlistOGE();
        List listOEE = new ProgEstrDao().getlistOEE(0);
        List listActividades = new ProgEstrDao().getlistActividades(0);
        List listAnios = new ProgEstrDao().getlistAnios();
        List listTableTituProg = new ProgEstrDao().getListTituProgForTable();
        form1.setOGE(listOGE);
        form1.setOEE(listOEE);
        form1.setACTIVIDAD(listActividades);
        form1.setListAnio(listAnios);
        form1.setListTableTituProg(listTableTituProg);
        return mapping.findForward("poi");
    }
}
